{include file="public/header" /}
<title>{:lang('推广佣金')}</title>
<body style="">
<header id="header" class="mui-bar mui-bar-nav">
    <div class="mui-pull-left PopupNavigation">
        <img src="/static/home/bl_1.png" alt="">
    </div>
    <h1 class="mui-title">{:lang('推广佣金')}</h1>
    <div class="mui-pull-right" style="display: none;">
        <div class="mui-switch mui-active" >
            <div class="mui-switch-handle"></di>
        </div>
    </div>
</header>

{include file="public/menu" /}

<div id="pullrefresh" class="mui-content">
    <div class="mui-scroll">
        <div class="mulativenumbBox">
            <div class="df mulativenumbxbd">
                <div class="fx1 mulativenumbzi mulativenumbybd">
                    <div class="span_1">{:lang('累计佣金')}</div>
                    <div class="span_2">$<span id="total_dividend">0</span></div>
                </div>
                <div class="fx1 mulativenumbzi">
                    <div class="span_1">{:lang('当日佣金')}</div>
                    <div class="span_2">$<span id="day_dividend">0</span></div>
                </div>
            </div>
            <div class="df">
                <div class="fx1 mulativenumbzi mulativenumbybd">
                    <div class="span_1">{:lang('月佣金')}</div>
                    <div class="span_2">$<span id="month_dividend"></span></div>
                </div>
                <div class="fx1 mulativenumbzi">
                    <div class="span_1">{:lang('年佣金')}</div>
                    <div class="span_2">$<span id="year_dividend"></span></div>
                </div>
            </div>
        </div>
        <div class="staataBox">
            <div class="staataTl">{:lang('佣金明细查看')}</div>
            <div class="staataTableBox">
                <table class="tabletada" border="0" cellspacing="" cellpadding="">
                    <thead>
                    <tr>
                        <th>{:lang('会员')}</th>
                        <th>{:lang('购买身份')}</th>
                        <th>{:lang('佣金比例')}</th>
                        <th>{:lang('佣金')}</th>
                        <th>{:lang('发放日期')}</th>
                    </tr>
                    </thead>
                    <tbody id="content">

                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    $(document).ready(function () {
        ajaxGetOrder();
    });
    var page = 0;

    function ajaxGetOrder() {
        if (stop == true || page == 0) {
            stop = false;
            if (page == 0) {
                $('#content').html('');
            }

            $('.loadAdd_bottom').hide();
            $('.loadAdd_nodata').hide();
            $('.loadAdd').show();
            $.ajax({
                type: "GET",
                url: "{:url('profitLog')}",//+tab,
                data: {p: page},
                success: function (data) {
                    page += 1;
                    $('.loadAdd').hide();
                    // layer.close(getMoreLoad);
                    if ($.trim(data) == '') {
                        stop = false;
                        if (page >= 2) {
                            $('.loadAdd_bottom').show();
                        } else if (page == 1) {
                            $('.loadAdd_nodata').show();
                        }
                    } else {
                        stop = true;
                        var html = '';
                        for(var i=0;i<data.list.length;i++){
                            html += '<tr><td>'+data.list[i].toname+'</td>';
                            html += '<td>'+data.list[i].order_id+'</td>';
                            html += '<td>'+data.list[i].rate+'%</td><td>'+data.list[i].num+'</td>';
                            html += '<td>'+data.list[i].created+'</td></tr>';
                        }
                        $('#content').append(html);
                    }
                }, error: function () {
                    mui.toast('网络失败，请刷新后重试', {duration: 'long', type: 'div'})
                }
            });
        }
    }

    var bottomH = 50;//距离底部多少像素开始加载
    var stop = true;
    $(window).scroll(function () {
        totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop() + bottomH);
        if ($(document).height() <= totalheight) {
            ajaxGetOrder();
        }
    });

    $.post("{:url('money/index')}", function(res){
        $('#total_dividend').html(res.total);
        $('#day_dividend').html(res.dayTotal);
        $('#month_dividend').html(res.monthTotal);
        $('#year_dividend').html(res.yearTotal);
    });
</script>


</body></html>